package com.andnnl.list;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by chenss on 2021/6/17.
 */
public class ListToArrayTest {
    public static void main(String[] args) {
        String s="1235456";
        System.out.println(s.substring(1));
        test1();
        test2();
        test3();
    }

    private static void test3() {
        int[] a={3, 4, 5, 6, 7, 1, 2, 8, 5, 5, 9, 5, 6, 10, 11, 12};
        System.out.println(Arrays.toString(a));
    }

    private static void test1() {
        List<Object> listObj=new ArrayList<>();
        listObj.add("asdf1");
        listObj.add("asdf2");
        listObj.add(222);
        Object[] objs=listObj.toArray();
        System.out.println(Arrays.toString(objs));
    }

    private static void test2() {
        List<String> listObj=new ArrayList<>();
        listObj.add("asdf1");
        listObj.add("asdf2222");
        String[] objs= listObj.toArray(new String[]{});
        System.out.println(Arrays.toString(objs));

        String mds=listObj.stream().collect(Collectors.joining("','","'","'"));
        System.out.println(mds);
    }
}
